package fristphase.day9_14;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class 泛型 {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        c.add("six");

        System.out.println(c);//重写了toString方法
        Iterator<String> it = c.iterator();
        while (it.hasNext()){
            String str = it.next();
            System.out.print(str);
        }
        System.out.println();
        for(String str : c){
            System.out.print(str);
        }
    }
}
